package cn.dnui_jzy913.dnuifood_16110100913.Activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;

import java.util.List;

import cn.dnui_jzy913.dnuifood_16110100913.bean.CommentsBean;
import cn.dnui_jzy913.dnuifood_16110100913.common.Constants;


public abstract class BaseActivity extends AppCompatActivity {
    abstract void initViews();
    abstract void initEvents();
    abstract void initData();
    protected abstract int initlayout();


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(initlayout());
        initViews();
        initEvents();
        initData();


    }
    public String getUser_id(){
        SharedPreferences sp;
        sp=getSharedPreferences("userInfo",Constants.MODE_PRIVATE);
        return sp.getString("user_id","");
    }
    public String getUser_password(){
        SharedPreferences sp;
        sp = getSharedPreferences("userInfo",Context.MODE_PRIVATE);
        return sp.getString("userpass","");
    }
    public void showToast(String msg){
        Toast.makeText(this,msg,Toast.LENGTH_LONG).show();
    }

}